import { classify } from "../../utils/type"

var app = getApp()
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    data: {
      type: Object,
      value: {}
    },
    className: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    detail: {},
    themeCode: '',
    color: ''
  },
  lifetimes: {
    attached() {
      //从本地获取当前选择的城市编码
      const themeCode = wx.getStorageSync('themeCode')
      this.setData({
        themeCode,
        color: app.globalData.dictMap.get('priceColor') 
      })
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    //打开对应的页面
    onOpenPage(res: any) {
      console.log(this.properties.data)
      wx.setStorageSync('product', this.properties.data)
      wx.navigateTo({ url: res.currentTarget.dataset.path + '?productId=' + this.data.data.id + '&className=' + this.properties.className + '&productName=' + this.properties.data.productName })
    }
  }
})